package main

var tmp_beg=`
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <atlstr.h>


#pragma comment(lib, "comctl32.lib")
#include <commctrl.h>

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#pragma comment(lib, "gdi32.lib")



struct
{
	int     iStyle;
    const char* szText;
}button[] =
{
`


var tmp_end=`
};

#define NUM (sizeof button / sizeof button[0])
HWND  hwndButton;
RECT  rect;
TCHAR szTop[] = TEXT("message            wParam       lParam"),
szUnd[] = TEXT("_______            ______       ______"),
szFormat[] = TEXT("%-16s%04X-%04X    %04X-%04X"),
szBuffer[50];
int   cxChar, cyChar;
HDC          hdc;
PAINTSTRUCT  ps;
int i;



LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	PSTR szCmdLine, int iCmdShow)
{
	static TCHAR szAppName[] = TEXT("ButtonTest");
	HWND         hwnd;
	MSG          msg;
	WNDCLASS     wndclass;

	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = WndProc;
	wndclass.cbClsExtra = 0;
	wndclass.cbWndExtra = 0;
	wndclass.hInstance = hInstance;
	wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	wndclass.lpszMenuName = NULL;
	wndclass.lpszClassName = szAppName;

	if (!RegisterClass(&wndclass))
	{
		MessageBox(NULL, TEXT("This program requires Windows NT!"),
			szAppName, MB_ICONERROR);
		return 0;
	}

	hwnd = CreateWindow(szAppName, TEXT("Button Test"),
		WS_OVERLAPPEDWINDOW,
		50, 50,
		700, 300,
		NULL, NULL, hInstance, NULL);

	ShowWindow(hwnd, iCmdShow);
	UpdateWindow(hwnd);
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char button_name[100] = { 0 };
	switch (message)
	{
	case WM_CREATE:
		cxChar = LOWORD(GetDialogBaseUnits());
		cyChar = HIWORD(GetDialogBaseUnits());
		sprintf_s(button_name, 100, "%s", button[0].szText);
		hwndButton = CreateWindow(TEXT("button"),
			CString(button_name),
			WS_CHILD | WS_VISIBLE | button[0].iStyle,
			35, 10, 500, 200,
			hwnd, (HMENU)0,
			((LPCREATESTRUCT)lParam)->hInstance, NULL);
			
		return 0;
	case WM_DRAWITEM:
	case WM_COMMAND:
		if (wParam == NUM-1){
			PostQuitMessage(0);
			return 0;
		}
		DestroyWindow(hwndButton);
		sprintf_s(button_name, 100, "%s", button[wParam+1].szText);
		hwndButton = CreateWindow(TEXT("button"),
			CString(button_name),
			WS_CHILD | WS_VISIBLE | button[wParam + 1].iStyle,
			35, 10, 500, 200,
			hwnd, (HMENU)(wParam + 1),
			HINSTANCE(hwnd), NULL);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;
	default:
		return DefWindowProc(hwnd, message, wParam, lParam);
	}
	
	
	return 0;
}
`

